package thread;

class MyThread4 extends Thread {
    @Override
    public void run() {
//        int a = 6;
        while (true) {
            System.out.println("hello thread");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
//            a--;
        }
    }
}

public class ThreadDemo11 {
    public static void main(String[] args) {
        Thread t = new MyThread4();
//        t.start();//创建一个信道线程由新的线程执行hello thread,并且也会执行main线程
        //看起来执行的结果一样,但是这个还是在main主线程打印的hello main,不会执行创建的线程
        t.run();
        while(true) {
            System.out.println("hello main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }

    }
}
